% Use only LaTeX2e, calling the article.cls class and 12-point type.

\documentclass[onecolumn,showpacs,twoside,10pt,prl]{revtex4}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{epsf}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{multirow}
\usepackage{hyperref}

\newcommand{\bra}[1]{\langle #1|}
\newcommand{\ket}[1]{|#1\rangle}

\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\bea}{\begin{eqnarray}}
\newcommand{\eea}{\end{eqnarray}}
\newcommand{\Fig}[1]{Fig.\,\ref{#1}}
\newcommand{\Eq}[1]{Eq.\,(\ref{#1})}
\newcommand{\la}{\langle}
\newcommand{\ra}{\rangle}
\newcommand{\nl}{\nonumber \\}
\usepackage[usenames]{color}
\definecolor{Red}{rgb}{1,0,0}
\definecolor{Blue}{rgb}{0,0,1}

\renewcommand\thefigure{S\arabic{figure}}



%%%%%%%%%%%%%%%%% END OF PREAMBLE %%%%%%%%%%%%%%%%



\begin{document}

% Include your paper's title here
\title{Supplementary Information for "Experimental Estimation of Average Fidelity of a Clifford Gate on a 7-qubit Quantum Processor"}
\author{Dawei Lu$^{1}$}
\author{Hang Li$^{1,2,3}$}
\author{Denis-Alexandre Trottier$^{1}$}
\author{Jun Li$^{1,4}$}
\author{Aharon Brodutch$^{1}$}
\author{Anthony P. Krismanich$^{5}$}
\author{Ahmad Ghavami$^{5}$}
\author{Gary I. Dmitrienko$^{5}$}
\author{Guilu Long$^{2,3}$}
\author{Jonathan Baugh$^{1,5}$}
\author{Raymond Laflamme$^{1,6,7}$}



\affiliation{$^{1}$Institute for Quantum Computing and Department of Physics and Astronomy,
University of Waterloo, Waterloo, Ontario N2L 3G1, Canada}
\affiliation{$^{2}$State Key Laboratory of Low-Dimensional Quantum Physics and Department of Physics, Tsinghua University, Beijing 100084, China}
\affiliation{$^{3}$Collaborative Innovation Center of Quantum Matter, Beijing 100084, China}
\affiliation{$^{4}$Department of Modern Physics, University of Science
and Technology of China, Hefei, Anhui 230026, China}
\affiliation{$^{5}$Department of Chemistry, University of Waterloo, Waterloo,
Ontario N2L 3G1, Canada}
\affiliation{$^{6}$Perimeter Institute for Theoretical Physics, Waterloo, Ontario N2L 2Y5, Canada}
\affiliation{$^{7}$Canadian Institute for Advanced Research, Toronto, Ontario M5G 1Z8, Canada}

\pacs{03.67.Lx, 03.65.Wj, 03.67.Ac}
\maketitle

\section{Average Fidelity and Average Channel}

Let $\mathcal{U}$ be the superoperator representation of  the target gate $U$ and $\tilde{\mathcal{U}} =\Lambda\circ \mathcal{U}$ be the superoperator representation of the real evolution in experiment so  $\Lambda$ is the noise superoperator. The average fidelity between $\mathcal{U}$ and $\tilde{\mathcal{U}}$ can be calculated  by averaging them over all states so
\begin{align} \label{average_state}
\bar{F}(\mathcal{U}, \tilde{\mathcal{U}}) & =  \int d\mu(\psi) \bra{\psi} \mathcal{U}^{\dagger} \circ \tilde{\mathcal{U}}(\ket{\psi} \bra{\psi}) \ket{\psi} \nonumber \\
& =  \int d\mu(\psi) \bra{\psi} \mathcal{U}^{\dagger} \circ \Lambda\circ \mathcal{U}(\ket{\psi} \bra{\psi}) \ket{\psi} \nonumber \\
& =  \int d\mu(\psi) \bra{\psi} \Lambda(\ket{\psi} \bra{\psi}) \ket{\psi},
\end{align}
where $d\mu(\psi)$ is known as the Fubini-Study measure \cite{Emerson2005}. The last equality is due to the fact that $d\mu(\psi)$ is unitarily invariant, so  $\bar{F}(\mathcal{U}, \tilde{\mathcal{U}})$ depends only on the error channel $\Lambda$, \emph{i.e.} $\bar{F}(\mathcal{U}, \tilde{\mathcal{U}}) = \bar{F}(\Lambda)$.

Equivalently, we can fix the state $\ket{\psi}$ and apply a distribution of random unitaries under the Haar measure $d\mu(\mathcal{V})$ \cite{Emerson2005}. Then
\begin{align} \label{average_Harr}
\bar{F}(\Lambda) = \int d\mu(\mathcal{V}) \bra{\psi} \mathcal{V}^{\dagger} \circ \Lambda \circ  \mathcal{V}(\ket{\psi} \bra{\psi}) \ket{\psi}.
\end{align}
By defining the average channel $\bar{\Lambda}$ through Haar twirling $\bar{\Lambda} = \int d\mu(\mathcal{V}) \mathcal{V}^{\dagger} \circ \Lambda \circ  \mathcal{V}$, we can see the average fidelity $\bar{F}(\Lambda)$ equals to the fidelity of the average channel $\bar{\Lambda}$.

A unitary 2-designs such as the finite $n$-qubit Clifford group $\mathcal{C}_n$ can be used to replace the continuous integral in \eqref{average_Harr} by a  sum over a the finite  set of unitaries $\mathcal{C}_n$ \cite{Dankert2009}.
\begin{align} \label{average_Clifford}
\bar{F}(\Lambda) &=  \frac{1}{|\mathcal{C}_n|}\sum_{\mathcal{C}_i\in \mathcal{C}_n}\bra{\psi} \mathcal{C}_i^{\dagger} \circ \Lambda \circ \mathcal{C}_i(\ket{\psi} \bra{\psi}) \ket{\psi}\\
&=\bra\psi\left[\frac{1}{|\mathcal{C}_n|}\sum_{\mathcal{C}_i\in \mathcal{C}_1} \mathcal{C}_i^{\dagger} \circ \Lambda \circ \mathcal{C}_i(\ket{\psi} \bra{\psi})\right]\ket\psi.
\end{align}

 We can now define a new  channel $\bar{\Lambda}_{\mathcal{C}_n} = \frac{1}{|\mathcal{C}_n|}\sum_{\mathcal{C}_i\in \mathcal{C}_1} \mathcal{C}_i^{\dagger} \circ \Lambda \circ \mathcal{C}_i$, which is called the $\mathcal{C}_n$ twirl of $\Lambda$.

 The $\mathcal{C}_n$  twirl of any superoperator $\Lambda$  is   a depolarizing  channel  \cite{Silva2008} with probability of no error $P_0$. 
\begin{align} \label{twirl_Cn}
\bar{\Lambda}_{\mathcal{C}_n}(\rho) =  P_0\rho + [1-P_0] \frac{\mathcal{I}^{\otimes n}}{2^n},
\end{align}
The fidelity of this channel $\bar{\Lambda}_{\mathcal{C}_n}$ with respect to the identity operator gives 
\begin{align} \label{fidelity}
\bar{F}(\Lambda) = F(\bar{\Lambda}_{\mathcal{C}_n}) = \frac{2^n P_0 +1}{2^n +1}.
\end{align}
Therefore, an estimate of the average fidelity $\bar{F}(\Lambda)$ can be obtained by measuring $P_0$. 

\section{Twirling over $C_1^{\otimes n} \Pi$ Group}

In order to get $P_0$ and consequently the average fidelity $\bar{F}(\Lambda)$ via Eq. \ref{fidelity}, we first introduce a group $C_1^{\otimes n} \Pi$, which consists of the $n$-fold tensor product of the 1-qubit Clifford group $C_1^{\otimes n}$ and  the  permutation group $\Pi$. Similarly to $\bar{\Lambda}_{\mathcal{C}_n}$, the average channel after the $C_1^{\otimes n} \Pi$ twirl is denoted as 
\begin{align} \label{C1_twirl}
\bar{\Lambda}_{\mathcal{C}_1^{\otimes n}\Pi} = \frac{1}{|\mathcal{C}_1^{\otimes n}\Pi|}\sum_{\mathcal{C}_i\in \mathcal{C}_1^{\otimes n}\Pi} \mathcal{C}_i^{\dagger} \circ \Lambda \circ \mathcal{C}_i.
\end{align}
 Twirling over $C_1^{\otimes n} \Pi$ transforms $\Lambda$ into a Pauli channel \cite{Silva2008}
\begin{align} \label{C1_twirlrho}
\bar{\Lambda}_{\mathcal{C}_1^{\otimes n}\Pi}(\rho) = \sum_{w=0}^n \text{Pr}(w) \left ( \frac{1}{3^w \binom{n}{w}} \sum_{i=1}^{3^w \binom{n}{w}} \mathcal{P}_{i,w} \rho \mathcal{P}_{i,w} \right ),
\end{align}
where $\text{Pr}(w)$ is the probability that a Pauli error of weight $w$ occurs, and $3^w \binom{n}{w}$ is the total number of weight-$w$ Pauli terms. In particular, $P_0=\text{Pr}(0)$, which indicates that we only need to measure the probability of no error in order to get an estimate of the average fidelity $\bar{F}(\Lambda)$ via Eq. \ref{fidelity}.

It can be demonstrated \cite{Silva2008,Alex2013} that $\text{Pr}(0)$ is a linear function of the eigenvalues $\{\lambda_w\}$ of the average channel $\bar{\Lambda}_{\mathcal{C}_1^{\otimes n}\Pi}$, with
\begin{align} \label{noerrorP}
\text{Pr}(0) = \sum_{w=0}^n \frac{3^w \binom{n}{w}}{4^n} \lambda_w.
\end{align}
$\lambda_w$ depends only on the weight of its associated Pauli operator and $\lambda_0=1$ by definition. To measure the eigenvalues $\{\lambda_w\}$ of the average channel $\bar{\Lambda}_{\mathcal{C}_1^{\otimes n}\Pi}$ using an ensemble system such as NMR \footnote{For a system where $\ket{0}^{\otimes n}$ can be achieved, one can start from $\ket{0}^{\otimes n}$, apply the average channel $\bar{\Lambda}_{\mathcal{C}_1^{\otimes n}\Pi}$, and measure in the $n$-bit string basis.}, we can prepare $n$ different input states $\rho_w = Z^{\otimes w}I^{\otimes n-w}$, send them through the average channel $\bar{\Lambda}_{\mathcal{C}_1^{\otimes n}\Pi}$, and measure its expectation value which is the projection onto itself. Then
\begin{align} \label{lambda_weight}
\lambda_w = \frac{1}{2^n}\text{tr}(\rho_w \bar{\Lambda}_{\mathcal{C}_1^{\otimes n}\Pi} (\rho_w)).
\end{align}
In practice, we do not have access to $\bar{\Lambda}_{\mathcal{C}_1^{\otimes n}\Pi}$, rather we only have access to the original channel $\tilde{\mathcal{U}}$. By substituting the form of $\bar{\Lambda}_{\mathcal{C}_1^{\otimes n}\Pi}$ in Eq. \ref{C1_twirl} to Eq. \ref{lambda_weight}, we have
\begin{align} \label{lambda_again}
\lambda_w & = \frac{1}{2^n|\mathcal{C}_1^{\otimes n}\Pi|} \sum_{\mathcal{C}_i\in \mathcal{C}_1^{\otimes n}\Pi} \text{tr}(\rho_w \mathcal{C}_i^{\dagger} \Lambda (\mathcal{C}_i \rho_w \mathcal{C}_i^{\dagger})\mathcal{C}_i) \nonumber \\
& = \frac{1}{2^n|\mathcal{C}_1^{\otimes n}\Pi|} \sum_{\mathcal{C}_i\in \mathcal{C}_1^{\otimes n}\Pi} \text{tr}( \Lambda (\mathcal{C}_i \rho_w \mathcal{C}_i^{\dagger})\mathcal{C}_i \rho_w \mathcal{C}_i^{\dagger}) \nonumber \\
& = \frac{1}{2^n3^w \binom{n}{w}} \sum_{\text{weight}(\rho_i) = w} \text{tr}( \Lambda (\rho_i) \rho_i). 
\end{align} 
The last equation is due to the fact that $\rho_i = \mathcal{C}_i \rho_w \mathcal{C}_i^{\dagger}$ traverses all of the $3^w \binom{n}{w}$ Pauli elements with weight $w$  for $\mathcal{C}_i\in \mathcal{C}_1^{\otimes n}\Pi$. The combination of Eq. \ref{lambda_weight} and Eq. \ref{lambda_again} gives a simple expression  the probability of no error 
\begin{align} \label{noerror}
\text{Pr}(0) = \frac{1}{4^n} \left( 1+ \frac{1}{2^n}\sum_{i=1}^{4^n-1} \text{Tr} ( \Lambda (\rho_i) \rho_i ) \right).
\end{align}

For arbitrary faulty Clifford operations $\tilde{\mathcal{U}_c} =\Lambda\circ \mathcal{U}_c$, we can insert the identity $\mathcal{U}_c \circ \mathcal{U}_c^\dagger$ appropriately and apply the faulty Clifford channel $\tilde{\mathcal{U}_c}$ on the input state $\rho_i$. Accordingly, the measurement operator needs to be changed to $M_{\rho_i, \mathcal{U}_c} = \mathcal{U}_c( \rho_{i})$. Note that $M_{\rho_i, \mathcal{U}_c}$ is also a Pauli operator as $\mathcal{U}_c$ is a Clifford gate, and it can be computed efficiently. Therefore, for certifying faulty Clifford gates $\tilde{\mathcal{U}_c}$, the probability of no error is 
\begin{align} \label{noerrorclifford}
\text{Pr}(0) = \frac{1}{4^n} \left( 1+ \frac{1}{2^n}\sum_{i=1}^{4^n-1} \text{Tr}\left( \tilde{\mathcal{U}_c} \left( \rho_{i}\right) M_{\rho_i, \mathcal{U}_c}\right)\right),
\end{align}
which is exactly Eq. 7 in the Letter.

In summary, to experimentally estimate the average fidelity of a Clifford gate $\tilde{\mathcal{U}_c}$, we can do $4^n-1$ experiments as the entire Pauli group $\mathcal{P}_n$ contains $4^n-1$ elements. In each experiment, the procedure is divided into three steps: prepare one Pauli operator $\rho_i$ out of $\mathcal{P}_n$ as the input state, apply the gate $\tilde{\mathcal{U}_c}$ to that input state in experiment, and measure the projection onto the Pauli operator $M_{\rho_i, \mathcal{U}_c} = \mathcal{U}_c( \rho_{i})$. After the repetition of all $4^n-1$ experiments, average the results over all experiments and compute $\text{Pr}(0)$ via Eq. \ref{noerrorclifford}, and then obtain the average fidelity $\bar{F}(\tilde{\mathcal{U}_c})$ via Eq. \ref{fidelity}. Additionally, if a certain confidence level is given, it is not necessary to carry out all $4^n-1$ experiments as described in the Letter. 

\section{Sample}
Our 7-qubit processor is a racemic mixture of per-$^{13}$C labeled (1S,4S,5S)-7,7-dichloro-6-oxo-2-thiabicyclo[3.2.0]heptane-4-carboxylic acid and its enantiomer.  The unlabeled compound was synthesized previously by us and its structure was established unambiguously by a single crystal X-ray diffraction study \cite{Johnson2008}.  The details of the synthesis of the per-$^{13}$C labeled compound will be reported elsewhere.  In the structure shown in Fig. \ref{para} the carbon atoms are numbered sequentially from 1 to 7 for convenience.

\begin{figure}[h]
%\centering
%\begin{minipage}[c]{.6\textwidth}
%\centering
\includegraphics[width= 0.95\columnwidth]{parax_new.pdf}
%\end{minipage}%
%\hspace{.05\textwidth}
%\begin{minipage}[c]{.3\textwidth}
%\centering
\caption{\footnotesize{(Color online) Molecular structure of Dichloro-cyclobutanone, where C$_1$ to C$_7$ form a 7-qubit system. The diagonal elements are chemical shifts (Hz), and the off-diagonal elements are scalar coupling strengths (Hz). T$_1$ and T$_{2}$ are the relaxation times (Second) of the individual spins, respectively. All parameters are obtained on a Bruker DRX 700 MHz spectrometer at room temperature.
}}
\label{para}
%\end{minipage}
\end{figure}

\section{Experimental Procedure}

For a given confidence level, we just need to randomly choose $m$ experiments out of the total $4^n-1$ experiments, where $m$ is independent of the number of qubits. In particular, with 99\% confidence level and 0.04 confidence interval, 1656 experiments are required to estimate the average fidelity of a Clifford gate. Before experiment, all of the 1656 Pauli operators as inputs were randomly chosen from the entire Pauli group, and divided into seven groups according to their Pauli weights. This is due to the fact that $\tilde{\mathcal{U}_c}$ is usually more prone to error when applied to higher weight Pauli states and the preparation methods for Pauli states with different weights are distinct. The Clifford gate $\tilde{\mathcal{U}_c}$ we want to certify was optimized by a GRAPE pulse with 80 ms length and 4000 segments. The simulated fidelity of this GRAPE pulse is over 0.99. There are two reasons for us to choose GRAPE rather than Gaussian shaped pulses to realize $\tilde{\mathcal{U}_c}$. First, it is hard to reach the accuracy of a GRAPE pulse with  a traditional shaped pulse due to the cross-talk effect and unwanted free Hamiltonian evolution during the finite width of that shaped pulse. Second, the refocusing scheme for a particular $ZZ$ evolution usually involves an exponential number of $\pi$ pulses to guarantee the Clifford property of the certified gate. 

The typical procedure of one experiment from the 1656 experiments is as follows:

(a) Create the input Pauli state. This was finished by employing an efficient sequence compiling program \cite{Ryan2008}. All pulses in the preparation are Gaussian shape pulses, with 1 ms for $\pi/2$ rotations and 2 ms for $\pi$ rotations. The typical duration for preparing a weight $w$ Pauli state is listed in Fig. 1d in the Letter. After the creation, we compared the results with the thermal equilibrium states, aiming to capture the errors occurring in preparation. This error should be deducted from the final results as they do not belong to the errors of the Clifford gate.

(b) Apply $\tilde{\mathcal{U}_c}$ on the input Pauli state. In order to minimize the discrepancies between the ideal pulse and the real pulse, we adopted a special calibration method called pulse fixing to improve the performance of this GRAPE pulse. 

(c) Measure the corresponding output Pauli state. The principle for NMR observation is to rotate one spin to \emph{X} while all the other spins to \emph{Z} or \emph{I}. All the readout pulses are local rotations with the lengths 1 ms, so we reasonably neglected the error in the readout stage. The ratio of the remaining signal compared to that of the reference input state was recorded.

After the repetition of all 1656 experiments, we averaged the results to obtain the  probability of no error $\text{Pr}(0)$, and then the average fidelity via Eq. \ref{fidelity}. The average fidelity is about 55.1\%, where the error can be mainly attributed to decoherence. The decoherence contribution was quantified by the approach of phase damping \cite{Vandersypen2001}, with the dynamical process simulated step by step since there are 4000 segments in the GRAPE pulse. In each segment, the dynamical process consists of a unitary operator generated by the Hamiltonian evolution and a non-unitary operator generated by the decoherence effect. As both of them can be estimated numerically, the final signal attenuation with respect to a given input state can be calculated by running over all 4000 segment in the GRAPE pulse. The average signal attenuation is about 37.4\%, which is slightly under-estimate as we only simulated $T_2$ relaxations. Under the assumption that the decoherence error can be factorized, the average fidelity after theoretically removing the decoherence is about 87.5\%.

\section{Experimental Spectra}

We also investigated the NMR spectra related to the certified gate $\tilde{\mathcal{U}_c}$. Since $\tilde{\mathcal{U}_c}$ can be used to generate $Z^{\otimes 7}$, one appropriate way to demonstrate the level of control by spectra is to generate $Z^{\otimes 7}$, observe all seven spins in seven experiments, and compare the simulated and experimental spectra, respectively. However, for most of the spins in our system, their spectra are highly degenerated due to the existence of very small J-couplings. As a result, the pair of anti-phase peaks produced by these minor J-couplings when observing $Z^{\otimes 7}$ will be canceled out and thus cannot be resolved in the spectra. C$_2$ is an exception and the observation of it after creating $Z^{\otimes 7}$ is shown in Fig. 2a in the Letter.

Nevertheless, we can observe the PPS spectra of every spin to obtain a qualitative indication of the performance of $\tilde{\mathcal{U}_c}$. The circuit for preparing the C$_7$-labeled PPS via the cat-state method \cite{Knill2000} is depicted in Fig. 1c in the Letter. It involves $\tilde{\mathcal{U}_c}$ as the encoding part, as well as a phase cycling to realize the coherence selection and tens of Gaussian shape pulses as the decoding part. The implementation of this circuit from the thermal equilibrium state will give the C$_7$-labeled PPS $\ket{0} \bra{0} ^{\otimes 6} \otimes Z$ ideally, and the observation of such a state is quite straightforward in NMR: when observing C$_7$, a single peak will be obtained as all the other six spins are occupying $\ket{0}$; while the observations of C$_1$ to C$_6$ will give two anti-phase peaks as 50\% of C$_7$ spins are in $\ket{0}$ and 50\% are in $\ket{1}$.

Fig. \ref{PPS}. shows the NMR spectra of the C$_7$-labeled PPS $\ket{0} \bra{0} ^{\otimes 6} \otimes Z$ by observing different spins. The thermal equilibrium spectrum is also provided as the reference in the top left position. Note that individual re-scaling factors (marked by Re-F) are applied when plotting the PPS spectra to achieve clearer lineshape comparisons. For example, the C$_4$ observation (Re-F: 1.2 \& 3.6) contains a 120\% zoom-in thermal equilibrium reference and 360\% zoom-in PPS. 

\begin{figure}[h]
%\centering
%\begin{minipage}[c]{.6\textwidth}
%\centering
\includegraphics[width= 0.95\columnwidth]{PPS_allspin.pdf}
%\end{minipage}%
%\hspace{.05\textwidth}
%\begin{minipage}[c]{.3\textwidth}
%\centering
\caption{\footnotesize{(Color online) NMR spectra of the reference thermal equilibrium state (blue) and C$_7$-labeled PPS: $\ket{0} \bra{0} ^{\otimes 6} \otimes Z$ (red). The observations of the PPS for all spins are shown. Re-F means the re-scaling factors for the reference and the PPS, respectively. }}
\label{PPS}
%\end{minipage}
\end{figure}

\begin{thebibliography}{99}
\bibitem{Emerson2005} J. Emerson, R. Alicki, and K. Zyczkowski, J. Opt. B \textbf{7}, S347 (2005).
\bibitem{Dankert2009} C. Dankert, R. Cleve, J. Emerson, and E. Livine, Phys. Rev. A \textbf{80}, 012304 (2009).
\bibitem{Silva2008} M. Silva, PhD thesis, University of Waterloo, 2008.
\bibitem{Alex2013} D. Trottier, Master thesis, University of Waterloo, 2013.
\bibitem{Johnson2008} J. W. Johnson, D. P. Evanoff, M. E. Savard, G. Lange, T. R.  Ramadhar, A. Assoud, N. J. Taylor, and G. I. Dmitrienko, J. Org. Chem. \textbf{73}, 6970 (2008).
\bibitem{Ryan2008} C. Ryan \emph{et al.}, Phys. Rev. A \textbf{78}, 012328 (2008).
\bibitem{Vandersypen2001} L. Vandersypen \emph{et al.}, Nature \textbf{414}, 883 (2001).
\bibitem{Knill2000} E. Knill, R. Laflamme, R. Martinez, C. Tseng, Nature \textbf{404}, 368 (2000).
\end{thebibliography}



\end{document}




















